package threecard.android;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class ThreeCardsActivity extends Activity implements OnClickListener{
	/** some request code. These code must be distinct and >= 0*/
	public static final int LOGIN_PARAM = 0;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //Setup click listener.
        
        //Login button
        View loginButton = findViewById(R.id.login_button);
        loginButton.setOnClickListener(this);
        
        //register button
        View registerButton = findViewById(R.id.register_button);
        registerButton.setOnClickListener(this);
        
        //help button
        View helpButton = findViewById(R.id.help_button);
        helpButton.setOnClickListener(this);
        
        //About button
        View aboutButton = findViewById(R.id.about_button);
        aboutButton.setOnClickListener(this);
        
        //Exit button
        View exitButton = findViewById(R.id.exit_button);
        exitButton.setOnClickListener(this);
        
    }

  //Responding to clicking events
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) { //Which button was clicked?
		
		case R.id.login_button:
			Intent login_intent = new Intent(this, Login.class);
			startActivityForResult(login_intent, LOGIN_PARAM);
			break;
		case R.id.about_button:
			Intent about_intent = new Intent(this, About.class);
			startActivity(about_intent);
			break;
		case R.id.register_button:
			Intent register_intent = new Intent(this, Register.class);
			startActivity(register_intent);
			break;
		case R.id.help_button:
			Intent help_intent = new Intent(this, Help.class);
			startActivity(help_intent);
			break;
		case R.id.exit_button:
			finish();
			break;
		default:
			break;
		}
	}
}